import ProForm, {
  ProFormDigit,
  ProFormRadio,
  ProFormText,
  ProFormTextArea
} from '@ant-design/pro-form';
import {Form, Modal} from 'antd';
import UploadList from "@/pages/content/components/UploadList";

const AddGrade = (props) => {
  const {closed,visible,open} = props;
  const [form] = Form.useForm();
  return (
    <div>
      <Modal
        title='添加会员等级'
        width={700}
        visible={visible}
        onOk={()=>{
          form.validateFields().then(async values=>{
            open(values)
          })
        }}
        onCancel={closed}
      >
      <ProForm
        form={form}
        submitter={false}
        layout='inline'
      >
        <ProFormText
          name="text"
          label="等级名称"
          width={500}
          placeholder='请输入等级名称'
        />
        <ProFormDigit
          name="input-number"
          label="等级"
          min={1}
          max={10}
          initialValue={7}
          width={100}
        />
        <ProFormDigit
          name="number"
          label="享受折扣"
          min={1}
          max={10}
          initialValue={2}
          width={100}
        />
        <ProFormDigit
          name="input"
          label="解锁需经验值达到"
          min={1}
          max={10}
          initialValue={3}
          width={100}
        />
        <ProFormText
          name='icon'
          label='图标'
        >
          <UploadList/>
        </ProFormText>
        <ProFormText
          name='background'
          label='会员背景'
        >
          <UploadList/>
        </ProFormText>
        <ProFormRadio.Group
          name="radio"
          label="是否显示"
          width={500}
          options={[
            {label: '显示', value: 'a',},
            {label: '隐藏', value: 'b',},
          ]}
        />
        <ProFormTextArea
          name='textArea'
          label='等级说明'
          placeholder='请输入等级说明'
          width={500}
        />
      </ProForm>
      </Modal>
    </div>
  );
};

export default AddGrade;
